package common;

import java.io.IOException;

import sun.misc.BASE64Decoder;     
import sun.misc.BASE64Encoder;


public class Encryption {
	public static String toBase64(byte[] binary) {
		return  new BASE64Encoder().encode(binary);
	}
	
	public static byte[] fromBase64(String text) {
		byte[] binary = null; 

		try {
			binary = new BASE64Decoder().decodeBuffer(text);
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return binary;
	}
}
